class LGXArrowInfo {
    constructor() {
        this.close = true;
        this.fill = true;
        this.angle = 30;
        this.size = 20;
        this.type = "triangle";
        this.name = "none";
        this.index = 0;
    }
}

class LGXArrowManager {
    constructor() {
        this.arrowList = [];
        this.initArrow();
    }

    getArrowInfo(name){
        let dstInfo = null;
        this.arrowList.forEach( p => {
            if (p.name == name){
                dstInfo = p;
                return ;
            }
        });
        return dstInfo;
    }

    getArrowInfoByIndex(idx){
        let dstInfo = null;
        this.arrowList.forEach( p => {
            if (p.index == idx){
                dstInfo = p;
                return ;
            }
        });
        return dstInfo;
    }

    getArrowDescList(){
        let list = [];
        this.arrowList.forEach( p => {
            let imageUrl = "/res/icon/arrow/"+p.index+".png";
            let name = p.index;
            let t = {imageUrl,name,index:p.index};
            list.push(t);
        });
        return list;
    }

    initArrow() {
        let noneArrow = new LGXArrowInfo();
        noneArrow.type = "none";
        noneArrow.name = "none";
        noneArrow.index = 0;
        this.arrowList.push(noneArrow);

        //三角形箭头--------------
        let triangle_mid_fill_close = new LGXArrowInfo();
        triangle_mid_fill_close.close = true;
        triangle_mid_fill_close.fill = true;
        triangle_mid_fill_close.angle = 30;
        triangle_mid_fill_close.size = 20;
        triangle_mid_fill_close.type = "triangle";
        triangle_mid_fill_close.name = "triangle_mid_fill_close";
        triangle_mid_fill_close.index = 1;
        this.arrowList.push(triangle_mid_fill_close);

        let triangle_mid_nofill_close = new LGXArrowInfo();
        triangle_mid_nofill_close.close = true;
        triangle_mid_nofill_close.fill = false;
        triangle_mid_nofill_close.angle = 30;
        triangle_mid_nofill_close.size = 20;
        triangle_mid_nofill_close.type = "triangle";
        triangle_mid_nofill_close.name = "triangle_mid_nofill_close";
        triangle_mid_nofill_close.index = 2;
        this.arrowList.push(triangle_mid_nofill_close);

        let triangle_mid_nofill_open = new LGXArrowInfo();
        triangle_mid_nofill_open.close = false;
        triangle_mid_nofill_open.fill = false;
        triangle_mid_nofill_open.angle = 30;
        triangle_mid_nofill_open.size = 20;
        triangle_mid_nofill_open.type = "triangle";
        triangle_mid_nofill_open.name = "triangle_mid_nofill_open";
        triangle_mid_nofill_open.index = 3;
        this.arrowList.push(triangle_mid_nofill_open);

        //----------------菱形箭头
        let diamond_mid_fill_close = new LGXArrowInfo();
        diamond_mid_fill_close.close = true;
        diamond_mid_fill_close.fill = true;
        diamond_mid_fill_close.angle = 60;
        diamond_mid_fill_close.size = 20;
        diamond_mid_fill_close.type = "diamond";
        diamond_mid_fill_close.name = "diamond_mid_fill_close";
        diamond_mid_fill_close.index = 4;
        this.arrowList.push(diamond_mid_fill_close);


        let diamond_mid_nofill_close = new LGXArrowInfo();
        diamond_mid_nofill_close.close = true;
        diamond_mid_nofill_close.fill = false;
        diamond_mid_nofill_close.angle = 60;
        diamond_mid_nofill_close.size = 20;
        diamond_mid_nofill_close.type = "diamond";
        diamond_mid_nofill_close.name = "diamond_mid_nofill_close";
        diamond_mid_nofill_close.index = 5;
        this.arrowList.push(diamond_mid_nofill_close);

        //----------------cad
        let cad_mid_fill_close = new LGXArrowInfo();
        cad_mid_fill_close.close = true;
        cad_mid_fill_close.fill = true;
        cad_mid_fill_close.angle = 30;
        cad_mid_fill_close.size = 2;
        cad_mid_fill_close.type = "cad";
        cad_mid_fill_close.name = "cad_mid_fill_close";
        cad_mid_fill_close.index = 6;
        this.arrowList.push(cad_mid_fill_close);
    }
}




export default { LGXArrowManager, LGXArrowInfo }
